package com.qf.j2112.service.impl;

import com.qf.j2112.mapper.DeptMapper;
import com.qf.j2112.po.Dept;
import com.qf.j2112.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;


@Service
public class DeptServiceImpl implements DeptService {
   @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> findAllDept() {
        List<Dept> depts = deptMapper.findDepts();
        return depts;
    }

    @Override
    public Dept updateDept(Dept dept) {
        int i = deptMapper.updateDepts(dept);
        if (i>-1)
            return dept;
        return null;
    }

    @Override
    public Dept addDept(Dept dept) {
        int i = deptMapper.addDepts(dept);
        if (i>-1)
            return dept;
        return null;
    }

    @Override
    public boolean deleteDept(int id) {
        int i = deptMapper.deleteDepts(id);
        if (i>-1)
            return true;
        return false;
    }
}
